import time
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
@pytest.fixture(scope="function")
def login():
    wd = webdriver.Chrome()
    # 打开有录网的网页
    wd.get('https://background-test.uofferglobal.com/#/login?redirect=%2Fdashboard')
    # 窗口最大化
    wd.maximize_window()
    # 输入账号
    element1 = WebDriverWait(wd, 10).until(lambda x: x.find_element(By.XPATH, '//*[@id="app"]/div/form/div[2]/div/div[1]/input'))
    element1.send_keys('1154605217@qq.com')
    # 输入密码
    element2 = WebDriverWait(wd, 10).until(lambda x: x.find_element(By.XPATH, '//*[@id="app"]/div/form/div[3]/div/div/input'))
    element2.send_keys('123456')
    # 点击登录的按钮
    WebDriverWait(wd, 10).until(lambda x: x.find_element(By.XPATH, '//*[@id="app"]/div/form/button')).click()
    return wd